﻿Public Class RCMS_WPListSorter
    Implements System.Collections.Generic.IComparer(Of String)

    Public Function Compare(ByVal x As String, ByVal y As String) As Integer _
                            Implements System.Collections.Generic.IComparer(Of String).Compare
        Dim returnVal As Integer = -1
        Dim s1 As String = x
        If s1 = "DATA" Then
            s1 = "02" & s1
        ElseIf s1 = "PP" Then
            s1 = "03" & s1
        ElseIf s1 = "VOICE" Then
            s1 = "04" & s1
        ElseIf s1 = "RISER" Then
            s1 = "05" & s1
        ElseIf s1 = "AUDIO" Then
            s1 = "06" & s1
        ElseIf s1 = "COAX" Then
            s1 = "07" & s1
        ElseIf s1 = "FIBER" Then
            s1 = "08" & s1
        Else
            If Mid$(s1, 1, 2) = "WP" Then
                s1 = "WP" & Mid(s1, 3).PadLeft(3, "0")
            End If
            s1 = "01" & s1
        End If
        Dim s2 As String = y
        If s2 = "DATA" Then
            s2 = "02" & s2
        ElseIf s2 = "PP" Then
            s2 = "03" & s2
        ElseIf s2 = "VOICE" Then
            s2 = "04" & s2
        ElseIf s2 = "RISER" Then
            s2 = "05" & s2
        ElseIf s2 = "AUDIO" Then
            s2 = "06" & s2
        ElseIf s2 = "COAX" Then
            s2 = "07" & s2
        ElseIf s2 = "FIBER" Then
            s2 = "08" & s2
        Else
            If Mid$(s2, 1, 2) = "WP" Then
                s2 = "WP" & Mid(s2, 3).PadLeft(3, "0")
            End If
            s2 = "01" & s2
        End If
        returnVal = [String].Compare(s1, s2)
        Return returnVal
    End Function
End Class
